<!--
 * @Author: your name
 * @Date: 2021-03-11 22:49:46
 * @LastEditTime: 2021-03-16 21:56:36
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \hmmm-frontend-117-10\src\module-hmmm\pages\ppp.html
-->
<!DOCTYPE html>
<html lang="zh-CN">

<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
</head>

<body>
	<input type="text" id="change">
</body>

</html>
<script>

	/* 	var input = document.getElementById('change')
		var n = null//用来储存计时器
		input.oninput = function () {
			if (n == null) {
				console.log(1);//为了他立即执行一次，初始值
				n = 1//如果不手动更改，n会一直为null，为了触发else执行
			} else {
				clearTimeout(n)//清除上一次定时器
				n = setTimeout(() => {//赋值新的定时器
					n = null//如果新的定时器触发了，更改n为null，准备下一次执行
					console.log(2);
				}, 1000);
			}
		} */
	var input = document.getElementById('change')
	var nul = null//这个值要放在外面，不然每次执行就重置了
	input.oninput = function () {
		if (nul == null) {
			console.log(5);
			nul = '1'
		} else {
			clearTimeout(nul)
			nul = setTimeout(() => {
				console.log(1);
			}, 1000);
		}




	}
















	/*
		var drr = ["1411A", "44", "34305", "djg", "pic", 100, 35, 28];
		function fun5(rr, num) {
			// for(var i = 0; i<rr.length;i++){
			// 	if(rr[i]==num){
			// 		rr.splice(i,1);
			// 		break;
			// 	}
			// }
			var newrr = rr.splice(num, 1);//newrr是被删除的那个数，所以不能返回，要返回删除之后的rr
			return rr;
		}
		console.log(fun5(drr, 0));
		var arr = []
		for (var i = 2; i <= 100; i++) {//拿到数据0-100
			for (var j = 2; j <= Math.sqrt(i); j++) {
				if (i % j !== 0) {
					arr.push(j)
				}
			}



		}
		console.log(arr, 6);
	 */



</script>